import { http, setToken, clearToken } from '@/utils'
export const getLogin = (data) => {
  return async (dispatch) => {
    const res = await http.post('/authorizations', data)
    const { token } = res.data.data
    setToken(token)
    dispatch({ type: 'login/token', payload: token })

    console.log(token)
  }
}
export const clearInfo = () => {
  return (dispatch) => {
    dispatch({ type: 'login/clearToken' })
    clearToken()
    dispatch({ type: 'login/clearInfo' })
  }
}
